/**
 * @file    If_can.h
 * @brief   驱动接口-CAN驱动
 * @author  Liuwei
 * @version 1.0.1
 * @date    2023-04-30
 * 
 * @copyright Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version   <th>Author   <th>Description
 * <tr><td>2023-04-30 <td>1.0.1     <td>Liuwei   <td>首次创建
 * </table>
 */

#ifndef __IF_CAN_H_
#define __IF_CAN_H_

/* file includes -------------------------------------------------------------*/
#include <drv_can.h>

/* cplusplus -----------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif

/* macro/define/typedef ------------------------------------------------------*/
#define CAN_SPEED_125K        (125000)
#define CAN_SPEED_250K        (250000)
#define CAN_SPEED_500K        (500000)
#define CAN_SPEED_1M          (1000000)

enum
{
    CAN_ID0 = DRV_CAN0,
    CAN_ID1 = DRV_CAN1, 

    IF_CAN_MAX, 
};
/* variables -----------------------------------------------------------------*/

/*******************************************************************************
 * public API List
 ******************************************************************************/
void If_can_init(uint8_t can_id , uint32_t can_speed);
void If_can_send_frame(uint8_t can_id ,can_frame_type send_msg);
uint8_t If_can_read_one_frame(uint8_t can_id ,can_frame_type *recv_msg);
void If_can_set_filter_mask(uint8_t can_id ,uint8_t rb_mb,uint8_t can_type, uint32_t filter_id , uint32_t mask);
void If_can_clr_buf(uint8_t can_id);

#ifdef __cplusplus
}
#endif

#endif  /* #ifndef __IF_CAN_H_ */
/********** Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD *********/
